#include <iostream>
#include <string>
using namespace std;

//https://www.nowcoder.com/questionTerminal/b2b816e20e8343b49abbaf493886ce26

string a, b;

int main()
{
	cin >> a >> b;
	int m = a.size(), n = b.size();
	int ret = m;
	
	for (int i = 0; i <= n - m; i++)
	{
		int tmp = 0;
		for (int j = 0; j < m; j++)
		{
			if (a[j] != b[i + j])
			{
				tmp++;
			}
		}
		ret = min(tmp, ret);
	}

	cout << ret << endl;


	return 0;
}